<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
		<style>
		.pDiv {
			width:500px;
			height:200px;
			position:relative;
			border:1px solid #000;
		}
		.cDiv {
			position:absolute;
			top:50%;
			left:50%;
			transform:translate(-50%,-50%);
			-webkit-transform:translate(-50%,-50%);
			-moz-transform:translate(-50%,-50%);
			-ms-transform:translate(-50%,-50%);
		}


		</style>
	</head>
	<body>
		<!--在不知道父元素宽高的情况下，可以使子元素垂直居中-->
		<div class="pDiv">
		    <div class="cDiv">任意子元素</div>
		</div>
	</body>
</html>
